package com.xin.data.simbapesa.view;

import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

import androidx.annotation.NonNull;

public class SimbaURLSpan extends ClickableSpan {

    ClickableSpanInterface onClickableSpanInterface;

    @Override
    public void onClick(@NonNull View widget) {
        if (onClickableSpanInterface != null) {
            onClickableSpanInterface.onClickableSpanClick(widget);
        }
    }

    @Override
    public void updateDrawState(@NonNull TextPaint ds) {
        super.updateDrawState(ds);
        ds.setUnderlineText(true);
    }

    public interface ClickableSpanInterface {
        void onClickableSpanClick(View view);
    }

    public ClickableSpanInterface getOnClickableSpanInterface() {
        return onClickableSpanInterface;
    }

    public void setOnClickableSpanInterface(ClickableSpanInterface onClickableSpanInterface) {
        this.onClickableSpanInterface = onClickableSpanInterface;
    }

}
